/** layui-v2.4.0 MIT License By https://www.layui.com */
;layui.define("jquery", function (e) {
  var i, o = layui.$, n = layui.device(), t = "dropdown", d = ".layui-dropdown-menu", r = "px",
    a = n.android || n.ios ? "click" : "mouseover";
  Dropdown = function () {
    this.inst = null, this.currReElem = null
  };
  var s = function (e) {
    ("BODY" == e.target.tagName || l(e.target) && l(e.target.parentElement) && l(e.target.parentElement.parentElement)) && i.hide()
  }, l = function (e) {
    return e && e.className.indexOf("layui-dropdown") == -1 && e.className.indexOf("layui-dropdown-menu") == -1
  };
  Dropdown.prototype.hide = function () {
    i && i.inst && i.inst.is(":visible") && (i.inst.removeClass("show").addClass("hide"), o("body").off(a, s))
  }, Dropdown.prototype.render = function () {
    i = this, o(".layui-dropdown").each(function (e, t) {
      var l = o(t);
      l.data("id", "dropdown-" + e), a = n.android || n.ios ? "click" : "mouseover", l[a](function () {
        if (!i.inst || i.currReElem.data("id") != l.data("id") || i.currReElem.data("id") == l.data("id") && !i.inst.is(":visible")) {
          i.hide();
          var e = l.find(d), n = l.offset().left - o(window).scrollLeft(), t = l.offset().top,
            u = (l.width(), l.height()), c = o(window).scrollTop(), w = t + u - c - 2, f = e.width(),
            p = e.outerHeight(), h = l.width(), m = n + h, v = n + f > o(window).width(),
            y = t + u + p - c > o(window).height(), g = {position: "fixed", top: w + 1 + r, left: n + r};
          v && o.extend(!0, g, {left: m - f + r}), y && o.extend(!0, g, {top: t - p - c + r}), e.removeClass("hide").addClass("show"), e.css(g).on("click", "li", function () {
            i.hide()
          }), i.inst = e, i.currReElem = l, o("body").on(a, s)
        }
      })
    })
  };
  var u = new Dropdown;
  u.render(), o(window).scroll(function () {
    u.hide()
  }), e(t, u)
});